/**
 * There are <a href="https://www.hdzhx.com">邯郸智讯</a> code generation
 */
package com.boxin.ims.modules.wechat.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 抽奖Entity
 * @author Jakemanse
 * @version 2013-09-23
 */
@Entity
@Table(name = "wp_lottery")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Lottery extends BaseEntity {
	public static String LOTTERY_TYPE_USER   = "1";
	public static String LOTTERY_TYPE_SELLER = "2";
	public static String LOTTERY_TYPE_SPECIFIED = "3";
	public static String LOTTERY_TYPE_ACTIVITY = "4";
	public static String LOTTERY_TYPE_NOTMEMBER = "5";
	public static String LOTTERY_TYPE_PAI = "6";
	
	
	
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private String name; 	// 名称
	private Integer peramount=1;	//每次生成的中奖人数
	private String  type;	//1:用户抽奖   2:店家抽奖   3.指定人员  4.活动奖品	5.非会员奖品
	private String  autoClear;	//是否自动核销  0:否  1：是
	private Integer percent;	//中奖机率
	private String  mobile;		//指定人
	private Integer score;		//领取的积分分值
	private Date createTime;	// 创建日期
	private String delFlag;	// 删除标记（0：正常；1：删除）
	private String remarks; // 备注
	
	
	 private Long sourceId;  //活动id  
	 private String sourceType;// 1 摇一摇活动模型奖品    2活动分享模型		3、三级推广奖品 		4、报名活动奖品
	 
	 private Integer upper;  //上限
	 private Integer lower;	//下限
	 private String  prizeimg;//奖品图片 
	  
	 private Integer repeatNum;	//重复次数
	 private String repeatType;	//重复类型，按	1：天、2：周、3：月、4：年
	 private String appointType;	//指定类型，按	1：指定时间、2：指定天数
	 private Date appointTime;	//指定时间
	 private Integer appointDayNum;	//指定天数
	 private String lotteryType;// 奖品类型        1  系统二维码            2卡券                3商户优惠券      4现金红包           5储值        6自定义奖品链接
	 private String wechatCardId;//  微信卡券领取链接     当lotteryType=6  为自定义链接

	public Lottery() {
		this.createTime = new Date();
		this.score = 0;
		this.delFlag = DEL_FLAG_NORMAL;
	}

	public Lottery(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_wechat_lottery")
	//@SequenceGenerator(name = "seq_wechat_lottery", sequenceName = "seq_wechat_lottery")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	@NotNull
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public Integer getPeramount() {
		return peramount;
	}

	public void setPeramount(Integer peramount) {
		this.peramount = peramount;
	}


	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getPercent() {
		return percent;
	}

	public void setPercent(Integer percent) {
		this.percent = percent;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Integer getScore() {
		return score==null ?0:score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public String getAutoClear() {
		return autoClear;
	}

	public void setAutoClear(String autoClear) {
		this.autoClear = autoClear;
	}

	public Long getSourceId() {
		return sourceId;
	}

	public void setSourceId(Long sourceId) {
		this.sourceId = sourceId;
	}

	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}

	public Integer getUpper() {
		return upper;
	}

	public void setUpper(Integer upper) {
		this.upper = upper;
	}

	public Integer getLower() {
		return lower;
	}

	public void setLower(Integer lower) {
		this.lower = lower;
	}

	public String getPrizeimg() {
		return prizeimg;
	}

	public void setPrizeimg(String prizeimg) {
		this.prizeimg = prizeimg;
	}

	public Integer getRepeatNum() {
		return repeatNum;
	}

	public void setRepeatNum(Integer repeatNum) {
		this.repeatNum = repeatNum;
	}

	public String getRepeatType() {
		return repeatType;
	}

	public void setRepeatType(String repeatType) {
		this.repeatType = repeatType;
	}

	public String getAppointType() {
		return appointType;
	}

	public void setAppointType(String appointType) {
		this.appointType = appointType;
	}

	public Date getAppointTime() {
		return appointTime;
	}

	public void setAppointTime(Date appointTime) {
		this.appointTime = appointTime;
	}

	public Integer getAppointDayNum() {
		return appointDayNum;
	}

	public void setAppointDayNum(Integer appointDayNum) {
		this.appointDayNum = appointDayNum;
	}

	public String getLotteryType() {
		return lotteryType;
	}

	public void setLotteryType(String lotteryType) {
		this.lotteryType = lotteryType;
	}

	public String getWechatCardId() {
		return wechatCardId;
	}

	public void setWechatCardId(String wechatCardId) {
		this.wechatCardId = wechatCardId;
	}

	
	
}